package com.example.shushiyunsst.util.media

import android.support.v4.media.MediaDescriptionCompat
import android.support.v4.media.session.MediaSessionCompat
import com.google.android.exoplayer2.Player
import com.google.android.exoplayer2.Timeline
import com.google.android.exoplayer2.ext.mediasession.TimelineQueueNavigator

class MediaQueueNavigator(
    mediaSession: MediaSessionCompat
) : TimelineQueueNavigator(mediaSession) {
    private val window = Timeline.Window()
    override fun getMediaDescription(player: Player, windowIndex: Int): MediaDescriptionCompat {
//        val tag = player.currentTimeline
//            .getWindow(windowIndex, window, 0).tag
//        return if (tag is MediaDescriptionCompat){
//            tag
//        }else{
//
//            mediaSession.getDescription()
//        }

                return player.currentTimeline
            .getWindow(windowIndex, window, 0).tag as MediaDescriptionCompat

    }
//        player.currentTimeline
//            .getWindow(windowIndex, window, 0).tag as MediaDescriptionCompat
}